factory: create components compatible mount units for kernel #229
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The kernel-modules components require that /lib/{modules,firmware} can be created by composition of what is shipped with the kernel plus parts that will be shipped by said component type.
For this, we need to have modinfo files in a writable directory as these files will need to be regenerated when a new kernel-modules component is installed. These files need to be readable from /lib/modules/UTS_RELEASE. Inside this directory, "kernel" and "vdso" subfolders will be bind-mounted from the kernel snap, while "updates" will have modules from the components.
In the case of UC, for modules we need an additional bind mount on top of the directory coming from the base (this is not needed for hybrid systems).
In the case of firmware, content from the kernel will be mounted to /lib/firmware as in the past. However, we will rely on the existence of a /lib/firmware/updates in the kernel to mount firware coming from components.
The mount units for the active kernel are created at boot time and stored in /run/systemd/system so they are accessible after the switch root, and are actually mounted after the switch happens, but with dependencies set so kernel modules are not loaded before the mounts are ready. This replaces the fstab/generator that was creating the mounts for modules/firmware in UC and hybrid respectively, and now unifies the approach for both.